using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace NetworkPower.DataAccess.Models.Mapping
{
    public class VoltageMap : EntityTypeConfiguration<Voltage>
    {
        public VoltageMap()
        {
            // Primary Key
            this.HasKey(t => new { t.VoltageID, t.VoltageValue, t.ProjectID });

            // Properties
            this.Property(t => t.VoltageValue)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("Voltages");
            this.Property(t => t.VoltageID).HasColumnName("VoltageID");
            this.Property(t => t.VoltageValue).HasColumnName("VoltageValue");
            this.Property(t => t.ProjectID).HasColumnName("ProjectID");
        }
    }
}
